import {defineStore} from 'pinia';
import {CardWidgets} from './interface';
import {getWidgetList} from "/@/api/system/widget";

/**
 * 用户信息
 * @methods setUserInfos 设置用户信息
 */
export const useCardWidgets = defineStore('cardWidgets', {
    state: (): CardWidgets => ({
        widgets: []
    }),
    actions: {
        async setWidgets() {
            let _this = this
            await getWidgetList({}).then(res => {
                _this.widgets = res.data
                localStorage.setItem('widgets', JSON.stringify(res.data))
            })
        },
    },
});
